import { ref } from 'vue'
import { getUserInfo } from '@/services/my/my'
import type { UserInfoApifoxModel } from '@/types/my/my'
import { useMemberStore } from '@/stores'

const code = ref()

// 获取个人信息 hook 函数
export const useUpdateUserInfo = () => {
  wx.login({
    success: (res) => {
      code.value = res.code
      console.log(res)
    },
  })
  const store = useMemberStore()
  async function getUserInfoFn() {
    const res = await getUserInfo<UserInfoApifoxModel>()
    store.setProfileData(res.data)
  }
  getUserInfoFn()
}
